from django.urls import path, re_path, include
from rest_framework import routers
from rest_framework.viewsets import ViewSet
# from api.views import UserLoginView, UserRegisterView
from .views import *
from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token


# 可以处理视图的路由器
router = routers.DefaultRouter()
# 向路由器中注册视图集,两个参数，一个是匹配的路由，一个是视图中写的CBV的类
# router.register(r'register', UserRegisterView.as_view(), basename='register')
router.register(r'login', UserLoginViewSet, basename='login')
router.register(r'register', UserRegisterViewSet, basename='register')
# router.register(r'products', views.ProductsViewSet, basename='products')

urlpatterns = [
    # re_path(r'^api-auth', include("rest_framework.urls", namespace="reset_framework")),
    re_path(r'^', include(router.urls)),
    path('jwt-login/', obtain_jwt_token),
    path('jwt-refresh/', refresh_jwt_token),
]

